package com.woniuxy.carrental.service.impl;

import com.woniuxy.carrental.entity.Carpart;
import com.woniuxy.carrental.mapper.CarpartMapper;
import com.woniuxy.carrental.service.CarPartService;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xilei
 * @create 2021-10-03 上午 11:12
 */
@Service
public class CarPartServiceImpl implements CarPartService {
    @Resource
    CarpartMapper carpartMapper;
    @Resource
    SqlSessionTemplate sqlSessionTemplate;

    @Override
    public List<Carpart> findCarpart() {
        List<Carpart> list = carpartMapper.findCarpart();
        return list;
    }

    @Override
    public List<Carpart> findCarpartBypage(Integer pageIndex, Integer pageSize) {
        List<Carpart> list = carpartMapper.findCarpartBypage(pageIndex, pageSize);
        return list;
    }

    @Override
    public List<Carpart> findCarpartBypageByparm(String carpart_name, String carpart_type, String carpart_vehicle, Integer pageIndex, Integer pageSize) {
        List<Carpart> list = carpartMapper.findCarpartBypageByparm(carpart_name, carpart_type, carpart_vehicle, pageIndex, pageSize);
        return list;
    }

    @Override
    public void updateCarpart(String carpart_name, String carpart_type, String carpart_vehicle, String carpart_picture, Integer carpart_id) {
        carpartMapper.updateCarpart(carpart_name, carpart_type, carpart_vehicle, carpart_picture, carpart_id);
    }

    @Override
    public void deleteCarpart(Integer carpart_id) {
        carpartMapper.deleteCarpart(carpart_id);
    }

    @Override
    public void insertCarpart(Carpart carpart) {
        carpartMapper.insertCarpart(carpart);
    }
}
